package com.doublefish.doublefishrobot.utils.db;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 作者:dugaofeng on 2024/10/17 08:59
 */
public class TimeStampUtils {

    //该时间戳是否是一天内
    public static boolean isIntraday(String timeStamp) {
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = format.parse(timeStamp);

            Date now = new Date();

            if (Math.abs(now.getTime() - date.getTime()) < 3600 * 24 * 1000) {
                return true;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
